package com.example.springboot4.system.config;

import lombok.Getter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 文件上传配置
 *
 * @author 宋义州
 * @since 2024/1/16 13:48
 */
@Component
@ConfigurationProperties(ignoreInvalidFields = true, prefix = "file")
@SuppressWarnings("unused")
public class FileConfigProperties {

    /**
     * 上传路径
     */
    @Getter
    private static String profile;

    public void setProfile(String profile) {
        FileConfigProperties.profile = profile;
    }

    /**
     * 获取导入上传路径
     */
    public static String getImportPath() {
        return getProfile() + "/import";
    }

    /**
     * 获取头像上传路径
     */
    public static String getAvatarPath() {
        return getProfile() + "/avatar";
    }

    /**
     * 获取下载路径
     */
    public static String getDownloadPath() {
        return getProfile() + "/download/";
    }

    /**
     * 获取上传路径
     */
    public static String getUploadPath() {
        return getProfile() + "/upload";
    }

}
